import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ElevatorRepairForm, ElevatorRepairQuery, ElevatorRepairVO } from '@/api/iot/elevatorRepair/types';

/**
 * 查询电梯维修列表
 * @param query
 * @returns {*}
 */

export const listElevatorRepair = (query?: ElevatorRepairQuery): AxiosPromise<ElevatorRepairVO[]> => {
  return request({
    url: '/iot/elevatorRepair/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询电梯维修详细
 * @param repairId
 */
export const getElevatorRepair = (repairId: string | number): AxiosPromise<ElevatorRepairVO> => {
  return request({
    url: '/iot/elevatorRepair/' + repairId,
    method: 'get'
  });
};

/**
 * 新增电梯维修
 * @param data
 */
export const addElevatorRepair = (data: ElevatorRepairForm) => {
  return request({
    url: '/iot/elevatorRepair',
    method: 'post',
    data: data
  });
};

/**
 * 修改电梯维修
 * @param data
 */
export const updateElevatorRepair = (data: ElevatorRepairForm) => {
  return request({
    url: '/iot/elevatorRepair',
    method: 'put',
    data: data
  });
};

/**
 * 删除电梯维修
 * @param repairId
 */
export const delElevatorRepair = (repairId: string | number | Array<string | number>) => {
  return request({
    url: '/iot/elevatorRepair/' + repairId,
    method: 'delete'
  });
};
